SoftClipA soft-clipping distortion effector that gradually rounds off the signal peaks once driven, producing a warmer, less harsh distortion character than HardClip.
Extends Effector.
import { SoftClip } from "@fluex/fluexgl-dsp";
const softClip = new SoftClip({
drive: 2,
gain: 0.8
});
...
channel.addEffect(softClip);
new SoftClip(options?: Partial<SoftClipOptions>): SoftClip;
options?: Partial<SoftClipOptions>
Optional soft-clip configuration (drive, gain, strictMode). Missing or non-finite fields fall back to the class defaults below; drive and gain are floored at 0. Defaults to {} when omitted entirely.label: string | nullCustom label for this effector. Defaults to "SoftClip".
name: stringInternal name for this effector. Defaults to "SoftClip".
drive: numberAmount of drive applied before clipping. Defaults to 1.
gain: numberOutput gain applied after clipping. Defaults to 1.
strictMode: StrictModeValidation mode passed through to the processor. Defaults to StrictMode.Disabled.
initializeOnAttachment(context: AudioContext): Promise<void>Initializes the effect by creating the AudioWorklet processor node (SoftClipProcessor) with the current option values. Unlike most other effectors, this guards against re-creating the node or overwriting an already-set context if called more than once.
context: AudioContextPromise<void>returnOptionsAsObject(): SoftClipOptionsReturns a plain object snapshot of the current drive, gain and strictMode values.
setDrive(drive: number): booleanUpdates drive (floored at 0) and forwards the change to the AudioWorklet processor.
drive: numberbooleansetGain(gain: number): booleanUpdates gain (floored at 0) and forwards the change to the AudioWorklet processor.
gain: numberbooleanInherited from Effector (incoming-processor-message, incoming-processor-warning, incoming-processor-error, processor-wasm-instantiated).
This class does not define public getters or setters.